function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = decodeURI(window.location.search).substr(1).match(reg);
    if (r != null)
        return unescape(r[2]);
    return "";
}

function RawUrl() {
    return window.location.pathname + window.location.search;
}
/*
name:名
value:值
time:保存时间(单位:毫秒)  time = null时表示关闭浏览器即消失
*/
function setCookie(name, value, time) {

    if (name == null || name.length < 0) {
        alert("不允许保存空的cookie名");
    }

    //设置编码 否则不支持中文
    var cookieVal = encodeURI(name + "=" + value);
    if (time != null) {
        var exp = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + time);
        cookieVal += ";expires=" + exp.toGMTString();
    }
    document.cookie = cookieVal;
}

function getCookie(name) {
    var arr = decodeURI(document.cookie).match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
    if (arr != null) return unescape(arr[2]); return null;
}

function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null)
        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}

function popQQtm(qq) {
    window.open("http://wpa.qq.com/msgrd?v=3&uin=" + qq + "&Site=test&Menu=yes");
}


function ToMethod(method) {
    $("#form1").append('<input type = "hidden" id = "method" name = "method" value = "' + method + '" />');
    document.form1.submit();

}

function ToLogin() {
    window.location.href = "login.aspx";
}

function ToUrl(url) {
    window.location.href = url;
}

function refresh() {
    history.go(0);
}
function HistoryGo(num) {
    history.go(num);
}

